﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace MechaShark
{
    class Renderer
    {
        //-------------Members-------------
        public BasicEffect currentEffect;

        //-------------Methods-------------
        //constructor
        public Renderer(GraphicsDeviceManager graphics)
        {
           currentEffect = new BasicEffect(graphics.GraphicsDevice);
        }
        //shaders
        #region Shaders
        public void DrawWithGrayEffect(Model model, Matrix view, Matrix proj) //insert Matrix world later
        {
            //basicEffect.World = world;
            currentEffect.View = view;
            currentEffect.Projection = proj;

            currentEffect.LightingEnabled = true;
            currentEffect.DiffuseColor = new Vector3(1.0f, 1.0f, 1.0f);//adjust diffuse color
            currentEffect.SpecularColor = new Vector3(0.1f, 0.1f, 0.1f);//adjust specular color
            currentEffect.SpecularPower = 3.0f;//adjust specular brightness
            currentEffect.AmbientLightColor = new Vector3(0.1f, 0.1f, 0.1f); //adjust ambient light color

            currentEffect.DirectionalLight0.Enabled = true;
            currentEffect.DirectionalLight0.DiffuseColor = Vector3.One;
            currentEffect.DirectionalLight0.Direction = Vector3.Normalize(new Vector3(1.0f, 1.0f, -1.0f));
            currentEffect.DirectionalLight0.SpecularColor = Vector3.One;
            currentEffect.DirectionalLight1.Enabled = true;
            currentEffect.DirectionalLight1.DiffuseColor = new Vector3(0.5f, 0.5f, 0.5f);
            currentEffect.DirectionalLight1.Direction = Vector3.Normalize(new Vector3(-1.0f, -1.0f, 1.0f));
            currentEffect.DirectionalLight1.SpecularColor = new Vector3(0.5f, 0.5f, 0.5f);
            foreach (ModelMesh meshes in model.Meshes)
            {
                foreach (ModelMeshPart parts in meshes.MeshParts)
                    parts.Effect = currentEffect;
                meshes.Draw();
            }
        }


        #endregion
    }
}
